package com.captain.special.数组;

/**
 * Des:
 *
 * @author XL
 * @Date 2022/4/17 21:59
 */
public class 增量元素之间的最大差值2016 {
    public int maximumDifference(int[] nums) {
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < nums.length; i++) {
            int iVal = nums[i];
            for (int j = i + 1; j < nums.length; j++) {
                int jVal = nums[j];
                if (iVal >= jVal) {
                    continue;
                }
                max = Math.max(max, jVal - iVal);
            }
        }
        return max == Integer.MIN_VALUE ? -1 : max;
    }
}
